package com.securitytrace.util;

import java.util.List;
import java.util.Vector;

import com.securitytrace.model.Product;


public class ProductConvertToVector extends ConvertAdapter<Product> {

	public  Vector<?> convertToVector(List<Product> products) {
		if(products == null || products.size()<1) {
			return null;
		}
		Vector<Vector<?>> vectors = new Vector<Vector<?>>();
		for(Product product : products) {
			if(convertToVector(product)== null) {
				return null;
			}
			vectors.add(convertToVector(product));
		}
		return vectors;
	}

	public Vector<?> convertToVector(Product product) {
		if(product == null) {
			return null;
		}
		Vector<String> vector = new Vector<String>();
		vector.add(product.getName());
		vector.add(product.getOtherInfo());
		return vector;
	}

}
